package cn.fanyamin.business;

import java.util.List;

public class CRUDService<K,T> implements ICRUD<K,T> {
	protected ICRUD<K,T> myDao;
	
	public CRUDService()  {

	}
	
	public CRUDService(ICRUD<K,T> dao)  {
        this.myDao = dao;
    }
	
	public K create(T t) {
		return myDao.create(t);
	}
	
	public int delete(K id) {
		return myDao.delete(id);
		
	}
	
	public List<T> find(T t) {
		return myDao.find(t);
	}
	
	public List<T> list() {
        return myDao.list();
    }
	
	public List<T> list(K id) {
        return myDao.list(id);
    }
	
	public T retrieve(K id) {
		return myDao.retrieve(id);
	}
	
	public int update(T t) {
		return myDao.update(t);
	}

    
    /**
     * @return the myDao
     */
    public ICRUD<K, T> getMyDao() {
        return myDao;
    }

    
    /**
     * @param myDao the myDao to set
     */
    public void setMyDao(ICRUD<K, T> myDao) {
        this.myDao = myDao;
    }
	
}
